import {
    followUp,
    centerEdit,
    formTimeLine,
    formInput,
    centerHeader,
    centerEditPad,
    input
} from '@/css/DialogsCss.module.scss';

export default {
    title: '新增记录',
    dialog: {
        size: '50%'
    },
    onMounted: [
        {
            action: 'set',
            target: '$view',
            field: 'title',
            value: '$params.title'
        }, {
            action: 'set',
            target: '$widgets.form',
            field: 'value',
            value: {
                uuid: '$params.form.uuid',
                salesman: '$params.form.salesman',
                corporate_name: '$params.form.corporate_name',
                customer_type: '"customer_pool"',
            }
        }, {
            var: 'timeline',
            action: 'service',
            path: 'crm/customers_pool/return_visit/list',
            params: {
                customer_uuid: '$params.form.uuid'
            },
        }, {
            action: 'set',
            target: '$widgets.timeline',
            field: 'items',
            value: '$vars.timeline'
        }
    ],
    items: [{
        region: 'center',
        class: followUp,
        layout: 'vertical',
        items: [{
            class: [centerEdit, centerEditPad],
            layout: 'vertical',
            items: [{
                id: 'form',
                widget: 'form',
                layout: {
                    type: 'gridform',
                    column: 2
                },
                fields: [{
                    class: input,
                    itemId: 'corporate_name',
                    widget: 'form-text',
                    label: '企业名称',
                }, {
                    class: input,
                    itemId: 'salesman',
                    widget: 'text',
                    label: '销售联系人',
                }, {
                    class: input,
                    itemId: 'contact',
                    placeholder: '请输入客户联系人',
                    widget: 'text',
                    label: '客户联系人',
                }, {
                    class: input,
                    itemId: 'phone',
                    placeholder: '请输入手机号码',
                    widget: 'text',
                    label: '手机号码',
                }, {
                    class: input,
                    itemId: 'contents',
                    placeholder: '请输入沟通内容',
                    widget: 'text',
                    label: '沟通内容',
                }, {
                    class: input,
                    itemId: 'create_time',
                    placeholder: '请选择回访时间',
                    widget: 'form-datepicker',
                    type: 'date',
                    label: '回访时间',
                }],
                buttons: [{
                    value: '保存',
                    type: 'primary',
                    onClick: [{
                        action: 'confirm',
                        title: '表单保存',
                        message: '是否保存表单?',
                        confirm: [{
                            var: 'value',
                            target: '$widget',
                            action: 'call',
                            method: 'getValue'
                        }, {
                            action: 'service',
                            path: 'crm/customers_pool/return_visit/save',
                            params: '$vars.value'
                        }, {
                            action: 'dialog-hide',
                            mode: 'apply'
                        }]
                    }]
                }],
            }],
        }, {
            class: [centerEdit, formTimeLine, centerHeader],
            items: [{
                class: formInput,
                id: 'title',
                widget: 'public-title',
                title: '跟进记录',
            }, {
                class: centerEditPad,
                id: 'timeline',
                widget: 'data-timeline',
                field: 'items',
                enableCard: true,
                enableTitle: false,
                placement: 'top',
                items: [{
                    timestamp: '2018-04-15',
                    size: 'large',
                    type: 'primary',
                    text: "2018-04-15于客户联系人进行对接"
                }, {
                    timestamp: '2018-04-13',
                    hollow: true,
                    color: '#0bbd87',
                    text: "2018-04-13于客户联系人进行对接"
                }, {
                    timestamp: '2018-04-11',
                    hollow: true,
                    text: "2018-04-11于客户联系人进行对接",
                }],
                flex: true
            }]
        }]
    }]
};




